Command queuing smart storage transfer manager for striping data to raw-NAND flash modules

ABSTRACT

A flash module has raw-NAND flash memory chips accessed over a physical-block address (PBA) bus by a NVM controller. The NVM controller is on the flash module or on a system board for a solid-state disk (SSD). The NVM controller converts logical block addresses (LBA) to physical block addresses (PBA). Data striping and interleaving among multiple channels of the flash modules is controlled at a high level by a smart storage transaction manager, while further interleaving and remapping within a channel may be performed by the NVM controllers. A SDRAM buffer is used by a smart storage switch to cache host data before writing to flash memory. A Q-R pointer table stores quotients and remainders of division of the host address. The remainder points to a location of the host data in the SDRAM. A command queue stores Q, R for host commands.

RELATED APPLICATIONS

This application is a continuation of “Command Queuing Smart StorageTransfer Manager for Striping Data to Raw-NAND Flash Modules”, U.S. Ser.No. 12/252,155 filed Oct. 15, 2008.

This application is a continuation-in-part (CIP) of “Multi-LevelController with Smart Storage Transfer Manager for Interleaving MultipleSingle-Chip Flash Memory Devices”, U.S. Ser. No. 12/186,471, filed Aug.5, 2008, which is a CIP of “High Integration of Intelligent Non-VolatileMemory Devices”, Ser. No. 12/054,310, filed Mar. 24, 2008, which is aCIP of “High Endurance Non-Volatile Memory Devices”, Ser. No.12/035,398, filed Feb. 21, 2008, which is a CIP of “High SpeedController for Phase Change Memory Peripheral Devices”, U.S. applicationSer. No. 11/770,642, filed on Jun. 28, 2007, which is a CIP of “LocalBank Write Buffers for Acceleration a Phase Change Memory”, U.S.application Ser. No. 11/748,595, filed May 15, 2007, which is CIP of“Flash Memory System with a High Speed Flash Controller”, applicationSer. No. 10/818,653, filed Apr. 5, 2004, now U.S. Pat. No. 7,243,185.

This application is also a CIP of co-pending U.S. Patent Application for“Multi-Channel Flash Module with Plane-Interleaved Sequential ECC Writesand Background Recycling to Restricted-write Flash Chips”, Ser. No.11/871,627, filed Oct. 12, 2007, and is also a CIP of “Flash Module withPlane-Interleaved Sequential Writes to Restricted-Write Flash Chips”,Ser. No. 11/871,011, filed Oct. 11, 2007.

This application is a continuation-in-part (CIP) of co-pending U.S.Patent Application for “Single-Chip Multi-Media Card/Secure Digitalcontroller Reading Power-on Boot Code from Integrated Flash Memory forUser Storage”, Ser. No. 12/128,916, filed on May 29, 2008, which is acontinuation of U.S. Patent Application for “Single-Chip Multi-MediaCard/Secure Digital controller Reading Power-on Boot Code fromIntegrated Flash Memory for User Storage”, Ser. No. 11/309,594, filed onAug. 28, 2006, now issued as U.S. Pat. No. 7,383,362, which is a CIP ofU.S. Patent Application for “Single-Chip USB Controller Reading Power-OnBoot Code from Integrated Flash Memory for User Storage”, Ser. No.10/707,277, filed on Dec. 2, 2003, now issued as U.S. Pat. No.7,103,684.

This application is also a CIP of co-pending U.S. Patent Application for“Electronic Data Flash Card with Fingerprint Verification Capability”,Ser. No. 11/458,987, filed Jul. 20, 2006, which is a CIP of U.S. PatentApplication for “Highly Integrated Mass Storage Device with anIntelligent Flash Controller”, Ser. No. 10/761,853, filed Jan. 20, 2004,now abandoned.

FIELD OF THE INVENTION

This invention relates to flash-memory solid-state-drive (SSD) devices,and more particularly to a smart storage switch connecting to multipleflash-memory endpoints.

BACKGROUND OF THE INVENTION

Host systems such as Personal Computers (PC's) store large amounts ofdata in mass-storage devices such as hard disk drives (HDD).Mass-storage devices are block-addressable rather than byte-addressable,since the smallest unit that can be read or written is a page that isseveral 512-byte sectors in size. Flash memory is replacing hard disksand optical disks as the preferred mass-storage medium.

NAND flash memory is a type of flash memory constructed fromelectrically-erasable programmable read-only memory (EEPROM) cells,which have floating gate transistors. These cells use quantum-mechanicaltunnel injection for writing and tunnel release for erasing. NAND flashis non-volatile so it is ideal for portable devices storing data. NANDflash tends to be denser and less expensive than NOR flash memory.

However, NAND flash has limitations. In the flash memory cells, the datais stored in binary terms—as ones (1) and zeros (0). One limitation ofNAND flash is that when storing data (writing to flash), the flash canonly write from ones (1) to zeros (0). When writing from zeros (0) toones (1), the flash needs to be erased a “block” at a time. Although thesmallest unit for read can be a byte or a word within a page, thesmallest unit for erase is a block.

Single Level Cell (SLC) flash and Multi Level Cell (MLC) flash are twotypes of NAND flash. The erase block size of SLC flash may be 128K+4Kbytes while the erase block size of MLC flash may be 256K+8K bytes.Another limitation is that NAND flash memory has a finite number oferase cycles between 10,000 and 100,000, after which the flash wears outand becomes unreliable.

Comparing MLC flash with SLC flash, MLC flash memory has advantages anddisadvantages in consumer applications. In the cell technology, SLCflash stores a single bit of data per cell, whereas MLC flash stores twoor more bits of data per cell. MLC flash can have twice or more thedensity of SLC flash with the same technology. But the performance,reliability and durability may decrease for MLC flash.

A consumer may desire a large capacity flash-memory system, perhaps as areplacement for a hard disk. A solid-state disk (SSD) made fromflash-memory chips has no moving parts and is thus more reliable than arotating disk.

Several smaller flash drives could be connected together, such as byplugging many flash drives into a USB hub that is connected to one USBport on a host, but then these flash drives appear as separate drives tothe host. For example, the host's operating system may assign each flashdrive its own drive letter (D:, E:, F:, etc.) rather than aggregate themtogether as one logical drive, with one drive letter. A similar problemcould occur with other bus protocols, such as Serial AT-Attachment(SATA), integrated device electronics (IDE), and Peripheral ComponentsInterconnect Express (PCIe). The parent application, now U.S. Pat. No.7,103,684, describes a single-chip controller that connects to severalflash-memory mass-storage blocks.

Larger flash systems may use several channels to allow parallel access,improving performance. A wear-leveling algorithm allows the memorycontroller to remap logical addresses to different physical addresses sothat data writes can be evenly distributed. Thus the wear-levelingalgorithm extends the endurance of the MLC flash memory.

What is desired is a multi-channel flash system with flash memory onmodules in each of the channels. A smart storage switch or hub isdesired between the host and the multiple flash-memory modules so thatdata may be striped across the multiple channels of flash. It is desiredthat the smart storage switch interleaves and stripes data accesses tothe multiple channels of flash-memory devices using a command queue thatstores quotient and remainder pointers for data buffered in a SDRAMbuffer.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A shows a smart storage switch that connects to raw NANDflash-memory devices.

FIG. 1B shows a host system using flash modules.

FIG. 1C shows flash modules arranged in parallel.

FIG. 1D shows flash modules arranged in series.

FIG. 2 shows a smart storage switch using flash memory modules withon-module NVM controllers.

FIG. 3A shows a PBA flash module.

FIG. 3B shows a LBA flash module.

FIG. 3C shows a Solid-State-Disk (SSD) board.

FIGS. 4A-F show various arrangements of data stored in raw-NAND flashmemory chips 68.

FIG. 5 shows multiple channels of dual-die and dual-plane flash-memorydevices.

FIG. 6 highlights data striping that has a stripe size that is closelycoupled to the flash-memory devices.

FIG. 7 is a flowchart of an initialization or power-up for each NVMcontroller 76 using data striping.

FIG. 8 is a flowchart of an initialization or power-up of the smartstorage switch when using data striping.

FIG. 9 shows a quad-channel smart storage switch with more details ofthe smart storage transaction manager.

FIG. 10 is a flowchart of a truncation process.

FIG. 11 shows a command queue and a Q-R Pointer table in the SDRAMbuffer.

FIG. 12 is a flowchart of a host interface to the sector data buffer inthe SDRAM.

FIGS. 13A-C is a flowchart of operation of a command queue manager.

FIG. 14 highlights page alignment in the SDRAM and in flash memory.

FIG. 15 highlights a non-aligned data merge.

FIGS. 16A-K are examples of using a command queue with a SDRAM buffer ina flash-memory system.

DETAILED DESCRIPTION

The present invention relates to an improvement in solid-state flashdrives. The following description is presented to enable one of ordinaryskill in the art to make and use the invention as provided in thecontext of a particular application and its requirements. Variousmodifications to the preferred embodiment will be apparent to those withskill in the art, and the general principles defined herein may beapplied to other embodiments. Therefore, the present invention is notintended to be limited to the particular embodiments shown anddescribed, but is to be accorded the widest scope consistent with theprinciples and novel features herein disclosed.

FIG. 1A shows a smart storage switch that connects to raw NANDflash-memory devices. Smart storage switch 30 connects to host storagebus 18 through upstream interface 34. Smart storage switch 30 alsoconnects to raw-NAND flash memory chips 68 over a physical block address(PBA) bus 473. Transactions on logical block address (LBA) bus 38 fromvirtual storage bridge 42 are demuxed by mux/demux 41 and sent to one ofNVM controllers 76, which convert LBA's to PBA's that are sent toraw-NAND flash memory chips 68. Each NVM controller 76 can have one ormore channels.

NVM controllers 76 may act as protocol bridges that provide physicalsignaling, such as driving and receiving differential signals on anydifferential data lines of LBA bus 38, detecting or generating packetstart or stop patterns, checking or generating checksums, andhigher-level functions such as inserting or extracting device addressesand packet types and commands. The host address from host motherboard 10contains a logical block address (LBA) that is sent over LBA bus 28,although this LBA may be remapped by smart storage switch 30 in someembodiments that perform two-levels of wear-leveling, bad-blockmanagement, etc.

Smart storage switch 30 may operate in single-endpoint mode. Smartstorage switch 30 operates an aggregating and virtualizing switch.

Internal processor bus 61 allows data to flow to virtual storageprocessor 140 and SDRAM 60. Buffers in SDRAM 60 coupled to virtualstorage bridge 42 can store the data. SDRAM 60 is a synchronousdynamic-random-access memory on smart storage switch 30. Alternately,SDRAM 60 buffer can be the storage space of a SDRAM memory modulelocated on host motherboard 10, since normally SDRAM module capacity onthe motherboard is much larger and can reduce the cost of smart storageswitch 30. Also, the functions of smart storage switch 30 can beembedded in host motherboard 10 to further increase system storageefficiency due to a more powerful CPU and larger capacity SDRAM spacethat is usually located in the host motherboard. FIFO 63 may be usedwith SDRAM 60 to buffer packets to and from upstream interface 34 andvirtual storage bridge 42.

Virtual storage processor 140 provides re-mapping services to smartstorage transaction manager 36. For example, logical addresses from thehost can be looked up and translated into logical block addresses (LBA)that are sent over LBA bus 38 to NVM controllers 76. Host data may bealternately assigned to NVM controllers 76 in an interleaved fashion byvirtual storage processor 140 or by smart storage transaction manager36. NVM controller 76 may then perform a lower-level interleaving amongraw-NAND flash memory chips 68 within one or more channels. Thusinterleaving may be performed on two levels, both at a higher level bysmart storage transaction manager 36 among two or more NVM controllers76, and within each NVM controller 76 among its raw-NAND flash memorychips 68.

NVM controller 76 performs logical-to-physical remapping as part of aflash translation layer function, which converts LBA's received on LBAbus 38 to PBA's that address actual non-volatile memory blocks inraw-NAND flash memory chips 68. NVM controller 76 may performwear-leveling and bad-block remapping and other management functions ata lower level.

When operating in single-endpoint mode, smart storage transactionmanager 36 not only buffers data using virtual storage bridge 42, butcan also re-order packets for transactions from the host. A transactionmay have several packets, such as an initial command packet to start amemory read, a data packet from the memory device back to the host, anda handshake packet to end the transaction. Rather than have all packetsfor a first transaction complete before the next transaction begins,packets for the next transaction can be re-ordered by smart storageswitch 30 and sent to NVM controllers 76 before completion of the firsttransaction. This allows more time for memory access to occur for thenext transaction. Transactions are thus overlapped by re-orderingpackets.

Packets sent over LBA bus 38 are re-ordered relative to the packet orderon host storage bus 18. Transaction manager 36 may overlap andinterleave transactions to different flash storage blocks, allowing forimproved data throughput. For example, packets for several incoming hosttransactions are stored in SDRAM buffer 60 by virtual storage bridge 42or an associated buffer (not shown). Transaction manager 36 examinesthese buffered transactions and packets and re-orders the packets beforesending them over LBA bus 38 to a downstream flash storage block in oneof raw-NAND flash memory chips 68.

FIG. 1B shows a host system using flash modules. Motherboard systemcontroller 404 connects to Central Processing Unit (CPU) 402 over afront-side bus or other high-speed CPU bus. CPU 402 reads and writesSDRAM buffer 410, which is controlled by volatile memory controller 408.SDRAM buffer 410 may have several memory modules of DRAM chips.

Data from flash memory may be transferred to SDRAM buffer 410 bymotherboard system controller using both volatile memory controller 408and non-volatile memory controller 406. A direct-memory access (DMA)controller may be used for these transfers, or CPU 402 may be used.Non-volatile memory controller 406 may read and write to flash memorymodules 414, or may access LBA-NVM devices 412 which are controlled bysmart storage switch 430.

LBA-NVM devices 412 contain both NVM controller 76 and raw-NAND flashmemory chips 68. NVM controller 76 converts LBA to PBA addresses. Smartstorage switch 30 sends logical LBA addresses to LBA-NVM devices 412,while non-volatile memory controller 402 sends physical PBA addressesover physical bus 422 to flash modules 414. A host system may have onlyone type of NVM sub-system, either flash modules 414 or LBA-NVM devices412, although both types could be present in some systems.

FIG. 1C shows that flash modules 414 of FIG. 1B may be arranged inparallel on a single segment of physical bus 422. FIG. 1D shows thatflash modules 414 of FIG. 1B may be arranged in series on multiplesegments of physical bus 422 that form a daisy chain.

FIG. 2 shows a smart storage switch using flash memory modules withon-module NVM controllers. Smart storage switch 30 connects to hostsystem 11 over host storage bus 18 through upstream interface 34. Smartstorage switch 30 also connects to downstream flash storage device overLBA buses 28 through virtual storage bridges 42, 43.

Virtual storage bridges 42, 43 are protocol bridges that also providephysical signaling, such as driving and receiving differential signalson any differential data lines of LBA buses 28, detecting or generatingpacket start or stop patterns, checking or generating checksums, andhigher-level functions such as inserting or extracting device addressesand packet types and commands. The host address from host system 11contains a logical block address (LBA) that is sent over LBA buses 28,although this LBA may be remapped by smart storage switch 30 in someembodiments that perform two-levels of wear-leveling, bad-blockmanagement, etc.

Buffers in SDRAM 60 coupled to virtual buffer bridge 32 can store thedata. SDRAM 60 is a synchronous dynamic-random-access memory on smartstorage switch 30. Alternately, SDRAM 60 buffer can be the storage spaceof a SDRAM memory module located in the host motherboard, since normallySDRAM module capacity on the motherboard is much larger and can save thecost of smart storage switch 30. Also, the functions of smart storageswitch 30 can be embedded in the host motherboard to further increasesystem storage efficiency due to a more powerful CPU and larger capacitySDRAM space that is usually located in host motherboard 10.

Virtual storage processor 140 provides re-mapping services to smartstorage transaction manager 36. For example, logical addresses from thehost can be looked up and translated into logical block addresses (LBA)that are sent over LBA buses 28 to flash modules 73. Host data may bealternately assigned to flash modules 73 in an interleaved fashion byvirtual storage processor 140 or by smart storage transaction manager36. NVM controller 76 in each of flash modules 73 may then perform alower-level interleaving among raw-NAND flash memory chips 68 withineach flash module 73. Thus interleaving may be performed on two levels,both at a higher level by smart storage transaction manager 36 among twoor more flash modules 73, and within each flash module 73 among raw-NANDflash memory chips 68 on the flash module.

NVM controller 76 performs logical-to-physical remapping as part of aflash translation layer function, which converts LBA's received on LBAbuses 28 to PBA's that address actual non-volatile memory blocks inraw-NAND flash memory chips 68. NVM controller 76 may performwear-leveling and bad-block remapping and other management functions ata lower level.

When operating in single-endpoint mode, smart storage transactionmanager 36 not only buffers data using virtual buffer bridge 32, but canalso re-order packets for transactions from the host. A transaction mayhave several packets, such as an initial command packet to start amemory read, a data packet from the memory device back to the host, anda handshake packet to end the transaction. Rather than have all packetsfor a first transaction complete before the next transaction begins,packets for the next transaction can be re-ordered by smart storageswitch 30 and sent to flash modules 73 before completion of the firsttransaction. This allows more time for memory access to occur for thenext transaction. Transactions are thus overlapped by re-orderingpackets.

Packets sent over LBA buses 28 are re-ordered relative to the packetorder on host storage bus 18. Transaction manager 36 may overlap andinterleave transactions to different flash storage blocks, allowing forimproved data throughput. For example, packets for several incoming hosttransactions are stored in SDRAM buffer 60 by virtual buffer bridge 32or an associated buffer (not shown). Transaction manager 36 examinesthese buffered transactions and packets and re-orders the packets beforesending them over internal bus 38 to a downstream flash storage block inone of flash modules 73.

A packet to begin a memory read of a flash block through bridge 43 maybe re-ordered ahead of a packet ending a read of another flash blockthrough bridge 42 to allow access to begin earlier for the second flashblock.

Clock source 62 may generate a clock to SDRAM 60 and to smart storagetransaction manager 36 and virtual storage processor 140 and other logicin smart storage switch 30. A clock from clock source 62 may also besent from smart storage switch 30 to flash modules 73, which have aninternal clock source 46 that generates an internal clock CK_SR thatsynchronizes transfers between NVM controller 76 and raw-NAND flashmemory chips 68 within flash module 73. Thus the transfer of physicalblocks and PBA are re-timed from the transfer of logical LBA's on LBAbuses 28.

FIG. 3A shows a PBA flash module. Flash module 110 contains a substratesuch as a multi-layer printed-circuit board (PCB) with surface-mountedraw-NAND flash memory chips 68 mounted to the front surface or side ofthe substrate, as shown, while more raw-NAND flash memory chips 68 aremounted to the back side or surface of the substrate (not shown).

Metal contact pads 112 are positioned along the bottom edge of themodule on both front and back surfaces. Metal contact pads 112 mate withpads on a module socket to electrically connect the module to a PCmotherboard. Holes 116 are present on some kinds of modules to ensurethat the module is correctly positioned in the socket. Notches 114 alsoensure correct insertion and alignment of the module. Notches 114 canprevent the wrong type of module from being inserted by mistake.Capacitors or other discrete components are surface-mounted on thesubstrate to filter noise from raw-NAND flash memory chips 68, which arealso mounted using a surface-mount-technology SMT process.

Since flash module 110 connects raw-NAND flash memory chips 68 to metalcontact pads 112, the connection to flash module 110 is through a PBA.Raw-NAND flash memory chips 68 of FIG. 1 could be replaced by flashmodule 110 of FIG. 3A.

Metal contact pads 112 form a connection to a flash controller, such asnon-volatile memory controller 406 in FIG. 408. Metal contact pads 122may form part of physical bus 422 of FIG. 1B. Metal contact pads 122 mayalternately form part of bus 473 of FIG. 1A.

FIG. 3B shows a LBA flash module. Flash module 73 contains a substratesuch as a multi-layer printed-circuit board (PCB) with surface-mountedraw-NAND flash memory chips 68 and NVM controller 76 mounted to thefront surface or side of the substrate, as shown, while more raw-NANDflash memory chips 68 are mounted to the back side or surface of thesubstrate (not shown).

Metal contact pads 112′ are positioned along the bottom edge of themodule on both front and back surfaces. Metal contact pads 112′ matewith pads on a module socket to electrically connect the module to a PCmotherboard. Holes 116 are present on some kinds of modules to ensurethat the module is correctly positioned in the socket. Notches 114 alsoensure correct insertion of the module. Capacitors or other discretecomponents are surface-mounted on the substrate to filter noise fromraw-NAND flash memory chips 68.

Since flash module 73 has NVM controller 76 mounted on it's substrate,raw-NAND flash memory chips 68 do not directly connect to metal contactpads 112′. Instead, raw-NAND flash memory chips 68 connect using wiringtraces to NVM controller 76, then NVM controller 76 connects to metalcontact pads 112′. The connection to flash module 73 is through a LBAbus from NVM controller 76, such as LBA bus 28 as shown in FIG. 2.

FIG. 3C shows a Solid-State-Disk (SSD) board that can connect directlyto a host. SSD board 440 has a connector 112″ that plugs into a hostmotherboard, such as into host storage bus 18 of FIG. 1A. Connector 112″can carry a SATA, PATA, PCI Express, or other bus. NVM controllers 76and raw-NAND flash memory chips 68 are soldered to SSD board 440. Otherlogic and buffers may be present in chip 442. Chip 422 can include smartstorage switch 30 of FIG. 1A.

Alternately, connector 122″ may form part of physical bus 422 of FIG.1B. Rather than use raw-NAND flash memory chips 68, LBA-NAND flashmemory chips may be used that receive logical addresses from the NVMcontroller.

FIGS. 4A-F show various arrangements of data stored in raw-NAND flashmemory chips 68. Data from the host may be divided into stripes bystriping logic 518 in FIG. 9 and stored in different flash modules 73,or in different raw-NAND flash memory chips 68 within one flash module73 that act as endpoints. The host's Operating System writes or readsdata files using a cluster (such as 4K Bytes in this example) as anaddress tracking mechanism. However during a real data transfer, it isbased on a sector (512-Byte) unit. For two-level data-striping, smartstorage switch 30 accounts for this when issuing to physical flashmemory pages (the programming unit) and blocks (the erasing unit).

FIG. 4A shows a N-way address interleave operation. The NVM controllersends host data in parallel to several channels or chips. For example,S11, S21, S31, SM1 can be data sent to one NVM controller or channel.N-way interleave can improve performance, since the host can sendcommands to one channel, and without waiting for the reply, the host candirectly send more commands to second channel, etc.

In FIG. 4A, data is arranged in a conventional linear arrangement. Thedata sequence received from the host in this example is S11, S12, S13, .. . , S1N, then S21, S22, S23, . . . , S2N, with SMN as the last data.In an actual system, the LBA addresses may not start from S11. Forexample, S13 may be the first data item. The last data item may not endwith SMN. For example. SM3 may be the last data item. Each N-token dataitem has four times as many pages as is stored in a memory location thatis physically on one flash storage device, such as 4×2K, 4×4K, 4×8K etc.Details of each token's data item are described later. A total of M dataitems are stored, with some of the data items being stored on differentflash storage devices. When a failure occurs, such as a flash-memorychip failing to return data, the entire data item is usually lost.However, other data items stored on other physical flash-memory chipscan be read without errors.

In FIG. 4B, data is striped across N flash-storage endpoints. Each dataitem is distributed and stored in the N flash-storage endpoints. Forexample, the first N-token data item consists of tokens S11, S12, S13, .. . S1N. The data item has token S11 stored in endpoint 1, token S12stored in endpoint 2, . . . , and token S1N stored in endpoint N. Dataitems can fill up all endpoints before starting to fill the next round.These data items may be stripes that are sectors or pages, or arealigned to multiple sectors or multiple pages.

FIG. 4C is another approach for adding one particular channel or chip asparity or ECC overhead to protect against errors in one of the Nendpoints. Each time the host controller reads results from the (N+1)channels and compares the results with the P parity value in the lastchannel to determine whether the results are correct. The Parity channelcan also be used to revive the correct value if ECC coding techniquesare used, which can include Reed-Solomon or BCH methods.

In FIG. 4C, data striping is performed across multiple storage endpointswith parity. The raw-NAND flash memory chips are partitioned into N+1endpoints. The N+1 endpoints are equal size, and the parity endpoint N+1is sufficiently large in size to hold parity or error-correcting code(ECC) for the other N endpoints.

Each data item is divided into N portions with each portion stored on adifferent one of the N endpoints. The parity or ECC for the data item isstored in the parity endpoint, which is the last endpoint, N+1. Forexample, an N-token data item consists of tokens S11, S12, S13, . . .S1N. The data item has token S11 stored in endpoint 1, token S12 storedin endpoint 2, token S13 stored in endpoint 3, . . . and token S1Nstored in segment N. The parity or ECC is stored in the parity endpointas token S1P.

In the diagram, each data item is stored across all endpoints as ahorizontal stripe. If one endpoint device fails, most of the data itemremains intact, allowing for recovery using the parity or ECC endpointflash devices.

FIG. 4D shows a distributed one-dimensional parity arrangement thatloads parity in a diagonal arrangement. S1P, S2P, S3P form a diagonalacross endpoints N−1, N, N+1. Fig. The parity is distributed across thediagonal direction to even out loading and to avoid heavy read and writetraffic that might occur in a particular P channel in the approach ofFIG. 4C.

FIG. 4E shows a one-dimensional parity that uses only two endpoints. Thecontents of the two endpoints are identical. Thus data is storedredundantly. This is a very easy approach but may waste storage space.

FIGS. 4E and 4F are the similar to FIGS. 4C and 4D with distributedparity on all endpoints instead of concentrated on one or two endpointsto avoid heavy usage on the parity segments.

FIG. 4F shows another alternate data striping arrangement using twoorthogonal dimension error correction values, parity and ECC. Twoorthogonal dimension ECC or parity has two different methods of errordetection/correction. For example, segment S1P uses one parity or ECCmethod, while segment S1P′ uses the second ECC method. A simple exampleis having one dimension using a hamming code, while the second dimensionis a Reed-Solomon method or a BCH method. With more dimension codes, thepossibility of recovery is much higher, protecting data consistency incase any single-chip flash-memory device fails in the middle of anoperation. A flash-memory device that is close to failure may bereplaced before failing to prevent a system malfunction.

Errors may be detected through two-level error checking and correction.Each storage segment, including the parity segment, has a page-basedECC. When a segment page is read, bad bits can be detected and correctedaccording to the strength of the ECC code, such as a Reed-Solomon code.In addition, the flash storage segments form a stripe with parity on oneof the segments.

As shown in FIGS. 4C-F, data can be stored in the flash storageendpoints' segments with extra parity or ECC segments in severalarrangements and in a linear fashion across the flash storage segments.Also, data can be arranged to provide redundant storage, which issimilar to a redundant array of independent disks (RAID) system in orderto improve system reliability. Data is written to both segments and canbe read back from either segment.

FIG. 5 shows multiple channels of dual-die and dual-plane flash-memorydevices. Multi-channel NVM controller 176 can drive 8 channels of flashmemory, and can be part of smart storage switch 30 (FIG. 1A). Eachchannel has a pair of flash-memory multi-die packaged devices 166, 167,each with first die 160 and second die 161, and each die with two planesper die. Thus each channel can write eight planes or pages at a time.Data is striped into stripes of 8 pages each to match the number ofpages that may be written per channel. Pipeline registers 169 inmulti-channel NVM controller 176 can buffer data to each channel.

FIG. 6 highlights data striping that has a stripe size that is closelycoupled to the flash-memory devices. Flash modules 73 of FIG. 2 andother figures may have two flash-chip packages per channel, towflash-memory die per package, and each flash memory die has two planes.Having two die per package, and two planes per die increases flashaccess speed by utilizing two-plane commands of flash memory. The stripesize may be set to eight pages when each plane can store one page ofdata. Thus one stripe is written to each channel, and each channel hasone flash module 73 with two die that act as raw-NAND flash memory chips68.

The stripe depth is the number of channels times the stripe size, or Ntimes 8 pages in this example. An 8-channel system with four die perchannel and two planes per die has 8 times 8 or 64 pages of data as thestripe depth that is set by smart storage switch 30. Data stripingmethods may change according to the physical flash memory architecture,when either the number of die or planes is increased, or the page sizevaries. Striping size may change with the flash memory page size toachieve maximum efficiency. The purpose of page-alignment is to avoidmis-match of local and central page size to increase access speed andimprove wear leveling.

When a flash transaction layer function is performed, NVM controller 76receives a Logical Sector Address (LSA) from smart storage switch 30 andtranslates the LSA to a physical address in the multi-plane flashmemory.

FIG. 7 is a flowchart of an initialization for each NVM controller 76using data striping. When the NVM controller 76 controls multiple die ofraw-NAND flash memory chips 68 with multiple planes per die for eachchannel, such as shown in FIGS. 5-6, each NVM controller 76 performsthis initialization routine when power is applied during manufacturingor when the configuration is changed.

Each NVM controller 76 receives a special command from the smart storageswitch, step 190, which causes NVM controller 76 to scan for bad blocksand determine the physical capacity of flash memory controlled by theNVM controller.

The maximum available capacity of all flash memory blocks in all diecontrolled by the NVM controller is determined, step 192, and theminimum size of spare blocks and other system resources. The maximumcapacity is reduced by any bad blocks found. These values are reservedfor use by the manufacturing special command, and are programmablevalues, but they cannot be changed by users.

Mapping from LBA's to PBA's is set up in a mapper or mapping table, step194, for this NVM controller 76. Bad blocks are skipped over, and someempty blocks are reserved for later use to swap with bad blocksdiscovered in the future. The configuration information is stored inconfiguration registers in NVM controller 76, step 196, and is availablefor reading by the smart storage switch.

FIG. 8 is a flowchart of an initialization of the smart storage switchwhen using data striping. When each NVM controller 76 controls multipledie of raw-NAND flash memory chips 68 with multiple planes per die foreach channel, such as shown in

FIGS. 5-6, the smart storage switch performs this initialization routinewhen power is applied during system manufacturing or when theconfiguration is changed.

The smart storage switch enumerates all NVM controllers 76, step 186, byreading the raw flash blocks in raw-NAND flash memory chips 68. The badblock ratio, size, stacking of die per device, and number of planes perdie are obtained. The smart storage switch sends the special command toeach NVM controller 76, step 188, and reads configuration registers oneach NVM controller 76, step 190.

For each NVM controller 76 enumerated in step 186, the number of planesP per die, the number of die D per flash chip, the number of flash chipsF per NVM controller 76 are obtained, step 180. The number of channels Cis also obtained, which may equal the number of NVM controllers 76 or bea multiple of the number of NVM controllers 76.

The stripe size is set to N*F*D*P pages, step 182. The stripe depth isset to C*N*F*D*P pages, step 184. This information is stored in the NVMconfiguration space, step 176.

FIG. 9 shows a quad-channel smart storage switch with more details ofthe smart storage transaction manager. Virtual storage processor 140,virtual buffer bridge 32 to SDRAM buffer 60, and upstream interface 34to the host all connect to smart storage transaction manager 36 andoperate as described earlier.

Four channels to four flash modules 950-953, each begin a flash module73 shown in FIGS. 2-3, are provided by four of virtual storage bridges42 that connect to multi-channel interleave routing logic 534 in smartstorage transaction manager 36. Host data can be interleaved among thefour channels and four flash modules 950-953 by routing logic 534 toimprove performance.

Host data from upstream interface 34 is re-ordered by reordering unit516 in smart storage transaction manager 36. For example, host packetsmay be processed in different orders than received. This is a veryhigh-level of re-ordering.

Striping logic 518 can divide the host data into stripes that arewritten to different physical devices, such as for a Redundant Array ofInexpensive Disks (RAID). Parity and ECC data can be added and checkedby ECC logic 520, while SLV installer 521 can install a new storagelogical volume (SLV) or restore an old SLV. The SLV logical volumes canbe assigned to different physical flash devices, such as shown in thisFig. for flash modules 950-953, which are assigned SLV#1, #2, #3, #4,respectively.

Virtualization unit 514 virtualizes the host logical addresses andconcatenates the flash memory in flash modules 950-953 together as onesingle unit for efficient data handling such as by remapping and errorhandling. Remapping can be performed at a high level by smart storagetransaction manager 36 using wear-level and bad-block monitors 526,which monitor wear and bad block levels in each of flash modules950-953. This high-level or presidential wear leveling can direct newblocks to the least-worn of flash modules 950-953, such as flash module952, which has a wear of 250, which is lower than wears of 500, 400, and300 on other flash module. Then flash module 952 can perform additionallow-level or governor-level wear-leveling among raw-NAND flash memorychips 68 (FIG. 2) within flash module 952.

Thus the high-level “presidential” wear-leveling determines theleast-worn volume or flash module, while the selected device performslower-level or “governor” wear-leveling among flash memory blocks withinthe selected flash module. Using such presidential-governorwear-leveling, overall wear can be improved and optimized.

Endpoint and hub mode logic 528 causes smart storage transaction manager36 to perform aggregation of endpoints for switch mode. Rather than usewear indicators, the percent of bad blocks can be used by smart storagetransaction manager 36 to decide which of flash modules 950-953 toassign a new block to. Channels or flash modules with a large percent ofbad blocks can be skipped over. Small amounts of host data that do notneed to be interleaved can use the less-worn flash module, while largeramounts of host data can be interleaved among all four flash modules,including the more worn modules. Wear is still reduced, whileinterleaving is still used to improve performance for larger multi-blockdata transfers.

FIG. 10 is a flowchart of a truncation process. The sizes or capacity offlash memory in each channel may not be equal. Even if same-size flashdevices are installed in each channel, over time flash blocks wear ourand become bad, reducing the available capacity in a channel.

FIG. 9 showed four channels that had capacities of 2007, 2027.5,1996.75, and 2011 MB in flash modules 950-953. The truncation process ofFIG. 10 finds the smallest capacity, and truncates all other channels tothis smallest capacity. After truncation, all channels have the samecapacity, which facilitates data striping, such as shown in FIG. 4.

The sizes or capacities of all volumes of flash modules are read, step202. The granularity of truncation is determined, step 204. Thisgranularity may be a rounded number, such as 0.1 MB, and may be set bythe system or may vary.

The smallest volume size is found, step 206, from among the sizes readin step 202. This smallest volume size is divided by the granularity,step 208. When the remainder is zero, step 210, the truncated volumesize is set to be equal to the smallest volume size, step 212. Norounding was needed since the smallest volume size was an exact multipleof the granularity.

When the remainder is not zero, step 210, the truncated volume size isset to be equal to the smallest volume size minus the remainder, step214. Rounding was needed since the smallest volume size was not an exactmultiple of the granularity.

The total storage capacity is then set to be the truncated volume sizemultiplied by the number of volumes of flash memory, step 216.

FIG. 11 shows a command queue and a Q-R Pointer table in the SDRAMbuffer. SDRAM 60 stores sector data from the host that is to be writteninto the flash modules as sector data buffer 234. Reads to the host maybe supplied from sector data 234 rather than from slower flash memorywhen a read hits into sector data buffer 234 in SDRAM 60.

Q-R pointer table 232 contains entries that point to sectors in sectordata buffer 234. The logical address from the host is divided by thesize of sector data buffer 234, such as the number of sectors that canbe stored. This division produces a quotient Q and a remainder R. Theremainder selects one location in sector data buffer 234 while thequotient can be used to verify a hit or a miss in sector data buffer234. Q-R pointer table 232 stores Q, R, and a data type DT. The datatype indicates the status of the data in SDRAM 60. A data type of 01indicates that the data in SDRAM 60 needs to be immediately flushed toflash memory. A data type of 10 indicates that the data is valid only inSDRAM 60 but has not yet been copied to flash memory. A data type of 11indicates that the data is valid in SDRAM 60 and has been copied toflash, so the flash is also valid. A data type of 00 indicates that thedata is not valid in SDRAM 60.

Data Types:

0, 0—Location is empty

1, 0—Data needs to be flushed into flash memory for storage, however theprocess can be in the background, no immediate urgency.

0, 1—Data is in the process of writing into flash memory, needs to bedone immediately.

1, 1—Data has already written into flash memory. The remaining image inSDRAM can be used for immediate Read or can be written by new incomingdata.

Commands from the host are stored in command queue 230. An entry incommand queue 230 for a command stores the host logical address LBA, thelength of the transfer, such as the number of sectors to transfer, thequotient Q and remainder R, a flag X-BDRY to indicate that the transfercrosses the boundary or end of sector data buffer 234 and wraps aroundto the beginning of sector data buffer 234, a read-write flag, and thedata type. Other data could be stored, such as an offset to the firstsector in the LBA to be accessed. Starting and ending logical addressescould be stored rather than the length.

FIG. 12 is a flowchart of a host interface to the sector data buffer inthe SDRAM. When a command from the host is received by the smart storageswitch, the host command includes a logical address such as a LBA. TheLBA is divided by the total size of sector data buffer 234 to get aquotient Q and a remainder R, step 342. The remainder R points to onelocation in sector data buffer 234, and this location is read, step 344.When the data type of the location R is either empty (00) or read cache(11), the location R may be overwritten since empty data type 00 can beoverwritten with new data which does not have to be copied back to flashimmediately and the read cache sector data has already been flushed backto flash memory, so that new data can be overwritten. The new data fromthe host overwrites location R in sector data buffer 234, and thislocation's entry in Q-R pointer table 232 is updated with the new Q,step 352. The data type is set to 10 to indicate that the data must becopied to flash, but not right away.

The length LEN is decremented, step 354, and the host transfer ends whenLEN reaches 0, step 356. Otherwise, the LBA sector address isincremented, step 358, and processed going back to step 342.

When location R read in step 344 has a data type of 01 or 10, step 346,the data in location R in SDRAM 60 is dirty and cannot be overwrittenbefore flushing to flash unless the host is overwriting to the exactsame address. When the quotient Q from the host address matches thestored Q, a write hit occurs, step 348. The new data from the host canoverwrite the old data in sector data buffer 234, step 352. The datatype is set to 10.

When the quotient Q does not match, step 348, then the host is writingto a different address. The old data in sector data buffer 234 must beflushed to flash immediately. The data type is first set to 01. Then theold data is written to flash, or to a write buffer such as a FIFO toflash, step 350. Once the old data has been copied for storage in flash,the data type can be set to read cache, 11. Then the process can loopback to step 344, and step 346 will be true, leading to step 352 wherethe host data will overwrite the old data that was copied to flash.

FIGS. 13A-C is a flowchart of operation of a command queue manager. Thecommand queue manager controls command queue 230 of FIG. 11. When thehost command is a read, step 432, and the LBA from the host hits in thecommand queue when the LBA falls within the range of LEN from thestarting LBA, step 436, the data from the host is read from the sectordata buffer, step 442, and sent to the host. A flash read has beenavoided by caching. The length can be decremented, step 444, and thecommand queue updated if needed, step 446. When the length reaches zero,step 448, the order of entries in the command queue can bere-prioritized, step 450, before the operation ends. When the length isnon-zero, the process repeats from step 432 for the next data in thehost transfer.

When the host LBA read misses in the command queue, step 436, and thequotients Q match in Q-R pointer table 232, step 438, there is amatching entry in sector data buffer 234 although there is no entry incommand queue 230. When the data type is read cache, step 440, the datamay be read from sector data buffer 234 and sent to the host, step 442.The process continues as described before.

When the data type is not read cache, step 440, the process continueswith A on FIG. 13B. The flash memory is read and loaded into SDRAM andsent to the host, step 458. Q, R, and the data type are updated in Q-Rpointer table 232, step 460, and the process continues with step 444 onFIG. 13A.

When the quotients Q do not match in Q-R pointer table 232, step 438,there is no matching entry in sector data buffer 234 and the processcontinues with B on FIG. 13B. In FIG. 13B, when the data type is writecache, (10 or 01), step 452, the old data is cast out of sector databuffer 234 and written to flash for necessary back up, step 454. Thepurge flag is then set, after the data is flushed to flash memory. Oncethe old data has been copied to a buffer for writing into flash, thedata type can be set to read cache 11 in Q-R pointer table 232, step456. The flash memory is read on request and loaded into SDRAM toreplaced the old data and sent to the host, step 458. Q, R, and the datatype 11 are updated in Q-R pointer table 232, step 460, and the processcontinues with E to step 444 on FIG. 13A.

When the data type is not write cache as recorded in the SDRAM, (00 or11), step 452, the flash memory is read and loaded into SDRAM and sentto the host, step 458. Q, R, and the data type 11 are updated in Q-Rpointer table 232, step 460, and the process continues with step 444 onFIG. 13A.

In FIG. 13A, when the host command is a write, step 432, and the LBAfrom the host hits in the command queue, step 434, the process continueswith D on FIG. 13C. The command queue is not changed, step 474. Thewrite data form the host is written into sector data buffer 234, step466. Q, R, and the data type are updated in Q-R pointer table 232, step472, and the process continues with step 444 on FIG. 13A.

In FIG. 13A, when the host command is a write, step 432, and the LBAfrom the host does not hit in the command queue, step 434, the processcontinues with C on FIG. 13C. When the quotients Q match in Q-R pointertable 232, step 462, there is a matching entry in sector data buffer234. The new resident flag is set, step 464, indicating that the entrydoes not overlap with another entry in the command queue. The write dataform the host is written into sector data buffer 234, step 466. Q, R,and the data type 01 (write cache) are updated in Q-R pointer table 232,step 472, and the process continues with E, step 444 on FIG. 13A.

When the quotient Q dos not match in Q-R pointer table 232, step 462,there is no matching entry in sector data buffer 234. The old data iscast out of sector data buffer 234 and written to flash, step 468. Thepurge flag is set, such as by setting the data type to 11. The purgeflag indicates that the data has been sent to the flash and can besafely overwritten. Once the old data has been copied to a buffer forwriting into flash, the data type can be set to read cache 11 in Q-Rpointer table 232, step 470. The write data from the host is writteninto sector data buffer 234, step 466. Q, R, and the data type areupdated in Q-R pointer table 232, step 472, and the process continueswith step 444 on FIG. 13A.

In FIG. 13A, when the host command is a write, step 432, and the LBAfrom the host hits in the command queue, step 434, the process continueswith D on FIG. 13C.

It will do nothing to the command queue at step 474, then continues towrite data from the host into sector data buffer 234, step 466. Q, R,and the data type 10 are updated in Q-R pointer table 232, step 472, andthe process continues with E to step 444 on FIG. 13A.

FIG. 14 highlights page alignment in the SDRAM and in flash memory.Pages may each have several sectors of data, such as 8 sectors per pagein this example. A host transfer has 13 sectors that are not pagealigned. The first four sectors 0, 1, 2, 3 are stored in page 1 of thesector data buffer 234 in SDRAM 60, while the next 8 sectors fill page2, and the final sector is in page 3.

When the data in sector data buffer 234 is flushed to flash memory, thedata from this transfer is stored in 3 physical pages in flash memory.The 3 pages do not have to be sequential, but may be on differentraw-NAND flash memory chips 68. The LBA, a sequence number, and sectorvalid bits are also stored for each physical page in flash memory. Thesector valid bits are all set for physical page 101, since all 8 sectorsare valid. The first four sectors in physical page 100 are set to all1's, while the valid data is stored in the last four sectors of thispage. These were sectors 0, 1, 2, 3 of the host transfer. Physical page102 receives the last sector from the host transfer and stores thissector in the first sector location in the physical page. The valid bitsof the other 7 sectors have their data bits all set to 0's, and the datasectors of these 7 sectors are unchanged.

FIG. 15 highlights a non-aligned data merge. Physical pages 100, 101,102 have been written as described in FIG. 14. New host data is writtento pages 1 and 2 of the SDRAM buffer and match the Q and R for the olddata stored in physical page 101.

Sectors in page 1 with data A, B, C, D, E are written to new physicalpage 103. The sequence number is incremented to 1 for this new transfer.

Old physical page 101 is invalidated, while its sector data 6, 7, 8, 9,10, 11 are copied to new physical page 200. Host data F, G from SDRAM 60is written to the first two sectors in this page 200 to merge the data.Old data 4, 5 is over-written by the new data F, G. SEQ# is used todistinguish which version is newer, in this case physical page 101 and200 have the same LBA number as recorded in FIG. 15. Firmware will checkits associated SEQ# to determine which page is valid.

FIGS. 16A-K are examples of using a command queue with a SDRAM buffer ina flash-memory system. SDRAM 60 has sector data buffer 234 with 16locations for sector data for easier illustration. In this example eachlocation holds one sector, but other page-based examples could storemultiple sectors per page location. The locations in SDRAM 60 arelabeled 0 to 15. Since there are 16 locations in SDRAM 60, the LBA isdivided by 16, and the remainder R selects one of the 16 locations inSDRAM 60.

In FIG. 16A, after initialization command queue 230 is empty. No hostsector data is stored in SDRAM 60. In FIG. 16B, the host writes C0 toLBA=1, with a length LEN of 3. An entry is loaded in command queue 230for write C0, with LBA set to 1 and LEN set to 3. Since the LBA dividedby 16 has a quotient Q of 0 and a remainder R of 3, 0,3 are stored forQ,R. The data type is set to 10, dirty and not yet flushed to flash.Data CO is written to locations 1, 2, 3 in SDRAM 60. The three sectors1, 2, 3 of Q-R PTR TBL 232 which point to the corresponding sector data234 will have 0,1,10 for the first sector, 0,2,10 for the second, and0,3,10 for the last sector in its contents. Note that the data value ofwrite CO may have any value and differ for each sector in sector data234. CO simply identifies the write command for this example.

In FIG. 16C, the host writes C1 to LBA=5, with a length LEN of 1.Another entry is loaded in command queue 230 for write C1, with LBA setto 5 and LEN set to 1. Since the LBA divided by 16 has a quotient Q of 0and a remainder R of 5, 0,5 are stored for Q,R. The data type is set to10, dirty and not yet flushed to flash. Data C1 is written to location 5in sector data 234 in SDRAM 60. Sector 5 of Q-R pointer table 232 isfilled with 0,5,10.

In FIG. 16D, the host writes C2 to LBA=14, with a length LEN of 4. Athird entry is loaded in command queue 230 for write C2, with LBA set to14 and LEN set to 4. Since the LBA divided by 16 has a quotient Q of 0and a remainder R of 14, 0,14 are stored for Q,R. The data type is setto 10, dirty and not yet flushed to flash.

Since the length of 4 writes to sectors 14, 15, 0, 1, which crosses orwraps from sector 15 to sector 0, the cross-boundary flag X is set forthis entry. Since sector 1 was previously written by write CO, and COhas not yet been written to flash, the old CO data in sector 1 must beimmediately flushed or cast out to flash. The data type for the firstentry is changed to 01, which indicates that an immediate write to flashis needed. This data type has a higher priority than other data types sothat the flush to flash can occur more quickly than other requests.After the flush to flash is done, the four sectors 14, 15, 0, 1 of Q-Rpointer table 232 are filled with 0,14,10, 0,15,10, 1,0,10, and 1,1,10.

In FIG. 16E, the cast out of the old CO data from sector 1 hascompleted. The first entry in command queue 230 is updated to accountfor sector 1 being cast out. The LBA is changed from 1 to 2, theremainder R is changed from 1 to 2, and the length reduced from 3 to 2.Thus the first entry in command queue 230 now covers 2 sectors of theold write CO rather than 3. The data type is changed to read cache 11,since the other sectors 2, 3 were also copied to flash with the sector 1cast out.

Now that the old C0 data in sector 1 has been cast out, the C2 writedata from the host is written to sectors 14, 15, 0, 1 in sector data 234of SDRAM 60 as shown in FIG. 16E.

In FIG. 16F, the host writes C3 to LBA 21 for a length of 3 sectors. Afourth entry is loaded in command queue 230 for write C3, with LBA setto 21 and LEN set to 3. Since the LBA divided by 16 has a quotient Q of1 and a remainder R of 5, 1,5 are stored for Q,R. The data type is setto 10, since the new C1 data will be dirty and not yet flushed to flash.

New data C3 is to be written to sectors 5, 6, 7 in SDRAM 60. Thesesectors are empty except for sector 5, which has the old C1 data thatmust be cast out to flash. The entry in command queue 230 for sector 5has its data type changed to 01 to request an immediate write to flash.In FIG. 16G, once this cast out is completed, the data type is changedto 11, read cache, to indicate a clean line that has been copied toflash. The old C1 data is still present in sector 5 of sector data 234in SDRAM 60.

In FIG. 16H, the new C3 data is written to sectors 5, 6, 7 of sectordata 234 in SDRAM 60. The old C1 data in sector 5 is overwritten, so itsentry in command queue 230 has its data type changed to 00, empty. Theold C1 entry can be cleared and later overwritten by a new host command.Sectors 5, 6, 7 of Q-R pointer table 232 are filled with 1,5,10, 1,6,10,and 1,7,10.

In FIG. 16I, the host reads R4 from LBA 17 for a length of 3 sectors.The LBA of 17 divided by the buffer size 16 produces a quotient of 1 anda remainder of 2. A new entry is allocated in command queue 230 for R4,with the data type set to read cache 11, since new clean data will befetched from flash memory into sector data 234 of SDRAM 60.

Location R=1 has the same Q of 1, and its data type is write cache 11showing that the sector data is usable. Since location R=2 and 3 arealready loaded with C0, and the first entry in command queue 230 shows aQ of 0, while the new Q is 1, the Q's mismatch. The host cannot read theold C0 data cached in sector data 234 of SDRAM 60. Instead, the old C0data is cast out to flash. However, since the data type is already 11,the C0 data was already cast-out in FIG. 16D, so no cast out is needed.The old entry for C0 is invalidated, and the new data R4 is read fromflash memory and written to sectors 1, 2, 3 in SDRAM 60 as shown in FIG.16J.

In FIG. 16K, the new data R4 is read from sectors 1, 2, 3 in sector data234 of SDRAM 60 and sent to the host. The boundary-crossing flag X isset for entry R4 in command queue 230. Sectors 2, 3 of Q-R pointer table232 are filled in with 1,2,11, and 1,3,11. Sector 1 remains the same.

Alternate Embodiments

Several other embodiments are contemplated by the inventors. Forexample, many variations of FIG. 1A and others are possible. A ROM suchas an EEPROM could be connected to or part of virtual storage processor140, or another virtual storage bridge 42 and NVM controller 76 couldconnect virtual storage processor 140 to another raw-NAND flash memorychip 68 that is dedicated to storing firmware for virtual storageprocessor 140. This firmware could also be stored in the main flashmodules.

The flash memory may be embedded on a motherboard or SSD board or couldbe on separate modules. Capacitors, buffers, resistors, and othercomponents may be added. Smart storage switch 30 may be integrated onthe motherboard or on a separate board or module. NVM controller 76 canbe integrated with smart storage switch 30 or with raw-NAND flash memorychips 68 as a single-chip device or a plug-in module or board.

Using a president-governor arrangement of controllers, the controllersin smart storage switch 30 may be less complex than would be requiredfor a single level of control for wear-leveling, bad-block management,re-mapping, caching, power management, etc. Since lower-level functionsare performed among raw-NAND flash memory chips 68 within each flashmodule 73 by NVM controllers 76 as a governor function, the presidentfunction in smart storage switch 30 can be simplified. Less expensivehardware may be used in smart storage switch 30, such as using an 8051processor for virtual storage processor 140 or smart storage transactionmanager 36, rather than a more expensive processor core such as a anAdvanced RISC Machine ARM-9 CPU core.

Different numbers and arrangements of flash storage blocks can connectto the smart storage switch. Rather than use LBA buses 28 ordifferential serial packet buses 27, other serial buses such assynchronous Double-Data-Rate (DDR), a differential serial packet databus, a legacy flash interface, etc.

Mode logic could sense the state of a pin only at power-on rather thansense the state of a dedicated pin. A certain combination or sequence ofstates of pins could be used to initiate a mode change, or an internalregister such as a configuration register could set the mode. Amulti-bus-protocol chip could have an additional personality pin toselect which serial-bus interface to use, or could have programmableregisters that set the mode to hub or switch mode.

The transaction manager and its controllers and functions can beimplemented in a variety of ways. Functions can be programmed andexecuted by a CPU or other processor, or can be implemented in dedicatedhardware, firmware, or in some combination. Many partitionings of thefunctions can be substituted.

Overall system reliability is greatly improved by employing Parity/ECCwith multiple NVM controllers 76, and distributing data segments into aplurality of NVM blocks. However, it may require the usage of a CPUengine with a DDR/SDRAM cache in order to meet the computing powerrequirement of the complex ECC/Parity calculation and generation.Another benefit is that, even if one flash block or flash module isdamaged, data may be recoverable, or the smart storage switch caninitiate a “Fault Recovery” or “Auto-Rebuild” process to insert a newflash module, and to recover or to rebuild the “Lost” or “Damaged” data.The overall system fault tolerance is significantly improved.

Wider or narrower data buses and flash-memory chips could besubstituted, such as with 16 or 32-bit data channels. Alternate busarchitectures with nested or segmented buses could be used internal orexternal to the smart storage switch. Two or more internal buses can beused in the smart storage switch to increase throughput. More complexswitch fabrics can be substituted for the internal or external bus.

Data striping can be done in a variety of ways, as can parity anderror-correction code (ECC). Packet re-ordering can be adjusteddepending on the data arrangement used to prevent re-ordering foroverlapping memory locations. The smart switch can be integrated withother components or can be a stand-alone chip.

Additional pipeline or temporary buffers and FIFO's could be added. Forexample, a host FIFO in smart storage switch 30 may be may be part ofsmart storage transaction manager 36, or may be stored in SDRAM 60.Separate page buffers could be provided in each channel. The CLK_SRCshown in FIG. 2 is not necessary when raw-NAND flash memory chips 68 inflash modules 73 have an asynchronous interface.

A single package, a single chip, or a multi-chip package may contain oneor more of the plurality of channels of flash memory and/or the smartstorage switch.

A MLC-based flash module 73 may have four MLC flash chips with twoparallel data channels, but different combinations may be used to formother flash modules 73, for example, four, eight or more data channels,or eight, sixteen or more MLC chips. The flash modules and channels maybe in chains, branches, or arrays. For example, a branch of 4 flashmodules 73 could connect as a chain to smart storage switch 30. Othersize aggregation or partition schemes may be used for different accessof the memory. Flash memory, a phase-change memory (PCM), orferroelectric random-access memory (FRAM), Magnetoresistive RAM (MRAM),Memristor, PRAM, SONOS, Resistive RAM (RRAM), Racetrack memory, and nanoRAM (NRAM) may be used.

The host can be a PC motherboard or other PC platform, a mobilecommunication device, a personal digital assistant (PDA), a digitalcamera, a combination device, or other device. The host bus orhost-device interface can be SATA, PCIE, SD, USB, or other host bus,while the internal bus to flash module 73 can be PATA, multi-channel SSDusing multiple SD/MMC, compact flash (CF), USB, or other interfaces inparallel. Flash module 73 could be a standard PCB or may be a multi-chipmodules packaged in a TSOP, BGA, LGA, COB, PIP, SIP, CSP, POP, orMulti-Chip-Package (MCP) packages and may include raw-NAND flash memorychips 68 or raw-NAND flash memory chips 68 may be in separate flashchips. The internal bus may be fully or partially shared or may beseparate buses. The SSD system may use a circuit board with othercomponents such as LED indicators, capacitors, resistors, etc.

Directional terms such as upper, lower, up, down, top, bottom, etc. arerelative and changeable as the system or data is rotated, flipped over,etc. These terms are useful for describing the device but are notintended to be absolutes.

Flash module 73 may have a packaged controller and flash die in a singlechip package that can be integrated either onto a PCBA, or directly ontothe motherboard to further simplify the assembly, lower themanufacturing cost and reduce the overall thickness. Flash chips couldalso be used with other embodiments including the open frame cards.

Rather than use smart storage switch 30 only for flash-memory storage,additional features may be added. For example, a music player mayinclude a controller for playing audio from MP3 data stored in the flashmemory. An audio jack may be added to the device to allow a user to plugin headphones to listen to the music. A wireless transmitter such as aBlueTooth transmitter may be added to the device to connect to wirelessheadphones rather than using the audio jack. Infrared transmitters suchas for IrDA may also be added. A BlueTooth transceiver to a wirelessmouse, PDA, keyboard, printer, digital camera, MP3 player, or otherwireless device may also be added. The BlueTooth transceiver couldreplace the connector as the primary connector. A Bluetooth adapterdevice could have a connector, a RF (Radio Frequency) transceiver, abaseband controller, an antenna, a flash memory (EEPROM), a voltageregulator, a crystal, a LED (Light Emitted Diode), resistors, capacitorsand inductors. These components may be mounted on the PCB before beingenclosed into a plastic or metallic enclosure.

The background of the invention section may contain backgroundinformation about the problem or environment of the invention ratherthan describe prior art by others. Thus inclusion of material in thebackground section is not an admission of prior art by the Applicant.

Any methods or processes described herein are machine-implemented orcomputer-implemented and are intended to be performed by machine,computer, or other device and are not intended to be performed solely byhumans without such machine assistance. Tangible results generated mayinclude reports or other machine-generated displays on display devicessuch as computer monitors, projection devices, audio-generating devices,and related media devices, and may include hardcopy printouts that arealso machine-generated. Computer control of other machines is anothertangible result.

Any advantages and benefits described may not apply to all embodimentsof the invention. When the word “means” is recited in a claim element,Applicant intends for the claim element to fall under 35 USC Sect. 112,paragraph 6. Often a label of one or more words precedes the word“means”. The word or words preceding the word “means” is a labelintended to ease referencing of claim elements and is not intended toconvey a structural limitation. Such means-plus-function claims areintended to cover not only the structures described herein forperforming the function and their structural equivalents, but alsoequivalent structures. For example, although a nail and a screw havedifferent structures, they are equivalent structures since they bothperform the function of fastening. Claims that do not use the word“means” are not intended to fall under 35 USC Sect. 112, paragraph 6.Signals are typically electronic signals, but may be optical signalssuch as can be carried over a fiber optic line.

The foregoing description of the embodiments of the invention has beenpresented for the purposes of illustration and description. It is notintended to be exhaustive or to limit the invention to the precise formdisclosed. Many modifications and variations are possible in light ofthe above teaching. It is intended that the scope of the invention belimited not by this detailed description, but rather by the claimsappended hereto.

1. A multi-level flash memory storage system comprising: a host whichuses a downstream interface to a plurality of multi-level flash memorystorage subsystems; a plurality of multi-level flash memory storagesubsystems, each multi-level flash memory storage subsystem furthercomprising: volatile memory sector buffer means for temporarily storinghost data in a volatile memory that loses data when power isdisconnected; a Smart Storage Switch (SSS) which comprises: an upstreaminterface to a host for receiving host commands to access Non-VolatileMemory (NVM) and for receiving host data and a host address; a smartstorage transaction manager that manages transactions from the host; avirtual storage processor that maps the host address to an assignedflash module to generate a Logical Block Address (LBA), the virtualstorage processor performing a first level of mapping; a virtual storagebridge between the smart storage transaction manager and a LBA bus; afirst-level stripping mapper, in the Smart Storage Switch, that maps theLBA to a plurality of flash memory modules; wherein first-level stripingis performed before the host data is sent to flash memory modules; aplurality of flash memory modules, wherein a flash module in theplurality of flash modules comprises: a NVM controller, coupled to theLBA bus to receive the LBA generated by the virtual storage processorand to receive the host data from the virtual storage bridge; asecond-level mapper, in the NVM controller, for mapping the LBA to aPhysical Block Address (PBA); a local clock source, within each of theplurality of flash modules, for generating local clocks for clocking theNVM controllers and interfaces to raw-NAND flash memory chips; whereinlocal clocks are generated within each of the plurality of flashmodules; raw-NAND flash memory chips, coupled to the NVM controller, forstoring the host data at a block location identified by the PBAgenerated by the second-level mapper in the NVM controller; wherein aflash memory module is a striping non-volatile-memory (NVM) system whichcomprises: a module interface to the virtual storage bridge thatgenerates striping data, address and commands; wherein the raw-NANDflash memory chips comprise a plurality of NVM devices each having aplurality of NVM memory blocks for storing stripping data that retainsdata when power is disconnected; a NVM storage processor that assignsSSS commands to an assigned device in the plurality of NVM devices, thestorage processor also storing attributes obtained from each of theplurality of NVM devices, the attributes including memory capacities,wherein the NVM storage processor reports an aggregate sum of the memorycapacities to the SSS; a data striping unit for segmenting SSS data intodata segments stored on several of the plurality of NVM devices; and astorage bridge, coupled between the NVM storage processor and theplurality of NVM devices; wherein flash memory is arranged as blocks ofmultiple pages, wherein pages are written and blocks are erased, whereinindividual pages are not individually erasable except by erasing allpages in a physical block; wherein flash memory is further arranged intoa plurality of planes that are plane-interleaved and accessible inparallel; further comprising: a volatile logical-physical mapping tablestoring mapping entries, wherein a mapping entry stores a logicaladdress of data from the SSS and a physical block address (PBA)indicating a location of the data within the flash memory; wherein amapping entry further comprises a plane number and a page number; atable restorer for restoring mapping entries in the volatilelogical-physical mapping table by accessing blocks of flash memory in aplane-interleaved order, wherein the volatile logical-physical mappingtable is restored from flash memory in the plane-interleaved order usinga second least-significant-bit (LSB) as a most-significant bit (MSB) ofthe physical block address, whereby address mapping is performed toaccess the raw-NAND flash memory chips.
 2. The multi-level flash memorystorage system of claim 1 wherein the plurality of multi-level flashmemory storage subsystems are directly soldered to the host on a samecircuit board.
 3. The multi-level flash memory storage system of claim 1wherein the plurality of multi-level flash memory storage subsystems areplugged into sockets on the host.
 4. The multi-level flash memorystorage system of claim 1 wherein the plurality of flash modules pluginto flash-module sockets; wherein the flash-module sockets are mountedto a circuit board; wherein the circuit board is a motherboard havingthe host and the multi-level flash memory storage subsystems, or adaughter card having the multi-level flash memory storage subsystems. 5.A flash memory module comprising: module interface means, coupled to ahost, for receiving commands to access flash memory and for receivingdata and an address; a Non-Volatile Memory (NVM) controller, coupled toa LBA bus to receive a LBA from the module interface means; a localclock source, receiving a clock from the module interface means, forgenerating local clocks for clocking NVM controllers and interfaces tothe flash memory, data striping mapping means for dividing the data intodata segments that are assigned to different ones of a plurality of NVMmemory devices; a plurality of NVM memory devices comprising: flashmemory arranged as blocks of multiple pages, wherein pages are writtenand blocks are erased, wherein individual pages are not individuallyerasable except by erasing all pages in a physical block; wherein theflash memory is further arranged into a plurality of planes that areplane-interleaved and accessible in parallel; a volatilelogical-physical mapping table storing mapping entries, wherein amapping entry stores a logical address of data from a NVM controller anda physical block address (PBA) indicating a location of the data withinthe flash memory; wherein the mapping entries further comprise a planenumber and a page number; a table restorer, coupled to a physicalsequential address counter, for restoring mapping entries in thevolatile logical-physical mapping table by accessing blocks of the flashmemory in a plane-interleaved order determined by the physicalsequential address counter, wherein the volatile logical-physicalmapping table is restored from flash memory in a plane-interleaved orderusing a second least-significant-bit (LSB) as a most-significant bit(MSB) of the physical block address.
 6. The flash memory module of claim5 further comprising a volatile memory buffer means for temporarilystoring data in a volatile memory that loses data when power isdisconnected.
 7. The flash memory module of claim 5 wherein a NVM memorydevice in the plurality of NVM memory devices comprises a single-chipmemory with NVM memories integrated with a controller, and anerror-correction code (ECC) processor.
 8. The flash memory module ofclaim 5 wherein the NVM memory device in the plurality of NVM memorydevices comprises a single-chip memory with NVM memories integrated witha controller, a striping architecture, and an ECC unit.
 9. The flashmemory module of claim 5 wherein the NVM memory device in the pluralityof NVM memory devices comprises a single-chip memory with NVM memoriesintegrated with an ECC unit.